#ifndef GRAPHICS_H_
#define GRAPHICS_H_

// INCLUDES //
#include "SDL/SDL_image.h"
#include "SDL/SDL_ttf.h"
#include "surface.h"
#include <string>
//////////////

using namespace std;

class Color
{
public:
	Color()
	{
		r = g = b = 255;
	}
	
	Color(int r, int g, int b)
	{
		this->r = r; this->g = g; this->b = b;
	}
	
	Uint32 ToUint32()
	{
		Uint32 color;
		color = r;
		color <<= 8;
		color += g;
		color <<= 8;
		color += b;
		return color;
	}
	
public:
	Uint8 r;
	Uint8 g;
	Uint8 b;
};

#define ALPHA_COLOR Color(255, 0, 255)
#define COLOR_BLACK Color(0, 0, 0)
#define COLOR_WHITE Color(255, 255, 255)
#define COLOR_RED Color(255, 0, 0)

enum Font
{
	FONT_KNIGHT,
	FONT_CICLE_FINA,
	FONT_DEJA_VU_SANS,
	FONT_DEJA_VU_SANS_BOLD
};

enum TextAlignment
{
	ALIGNMENT_LEFT = 1,
	ALIGNMENT_MIDDLE = 2,
	ALIGNMENT_RIGHT = 4,
	ALIGNMENT_TOP = 8,
	ALIGNMENT_CENTER = 16,
	ALIGNMENT_BOTTOM = 32
};

/**
* Graphics utility functions.
* 
* @author dfoelber
**/
class Graphics
{
public:
	static void DrawRectangle( Surface* surface, Color c, int x, int y, int width, int height, bool fill = false );
	
	static void DrawFont( Surface* surface, string s, Font font, int size, Color c, int x, int y, int alpha = SDL_ALPHA_OPAQUE );
	
	static void DrawFont( Surface* surface, string s, Font font, int size, Color c, int x, int y, int width, int height, int alignment, int alpha = SDL_ALPHA_OPAQUE );
	
	static void GetFontSize( Font font, string s, int size, int* w, int* h );
	
private:
	static TTF_Font* GetFont( Font font, int size );
};

#endif /*GRAPHICS_H_*/
